// 自定义校验
const validateKey1 = (rule, value, callback) => {
    const isChinese = /^[\u4e00-\u9fa5]+$/
    if (!isChinese.test(value)) {
        callback(new Error('店主姓名必须为中文'))
    } else {
        callback()
    }
}

export const modalFormConfig = {
    // 表单循环每一项样式
    itemStyle: {
        padding: '15px 0px'
    },
    // 表单栅格布局
    colLayout: { span: 12 },
    // 表单循环每一项配置
    formItems: [
        {
            field: 'key1',
            type: 'input',
            label: '店主姓名',
            isHidden: false,
            rules: [
                {
                    required: true,
                    message: '店主姓名不能为空',
                    trigger: 'blur'
                },
                {
                    validator: validateKey1,
                    trigger: 'blur'
                }
            ],
            otherOptions: {
                disabled: false,
                placeholder: '请输入店主姓名',
            }
        },
        {
            field: 'key2',
            type: 'input',
            label: '店铺名称',
            isHidden: false,
            rules: [
                {
                    required: true,
                    message: '店铺名称不能为空',
                    trigger: 'blur'
                }
            ],
            otherOptions: {
                placeholder: '请输入店铺名称',
            }
        },
        {
            field: 'key3',
            type: 'input',
            label: '店铺UId',
            isHidden: false,
            rules: [
                {
                    required: true,
                    message: '店铺UId不能为空',
                    trigger: 'blur'
                }
            ],
            otherOptions: {
                placeholder: '请输入店铺UId',
            }
        },
        {
            field: 'key4',
            type: 'select',
            label: '店铺类型',
            isHidden: false,
            rules: [
                {
                    required: true,
                    message: '店铺类型不能为空',
                    trigger: 'blur'
                }
            ],
            options: [
                { value: 1, label: "抖音小店" },
                { value: 2, label: "淘宝小店" }
            ],
            otherOptions: {
                placeholder: '请选择店铺类型',
            }
        },
        {
            field: 'key5',
            type: 'select',
            label: '注入状态',
            isHidden: false,
            rules: [
                {
                    required: true,
                    message: '注入状态不能为空',
                    trigger: 'blur'
                }
            ],
            options: [
                { value: 1, label: "已准入" },
                { value: 2, label: "未用过" }
            ],
            otherOptions: {
                placeholder: '请选择注入状态',
            }
        },
        {
            field: 'key6',
            type: 'input',
            label: '电子签章',
            isHidden: false,
            rules: [
                {
                    required: true,
                    message: '电子签章不能为空',
                    trigger: 'blur'
                }
            ],
            otherOptions: {
                placeholder: '请输入电子签章',
            }
        },
        {
            field: 'key7',
            type: 'input',
            label: '主体资质',
            isHidden: false,
            rules: [
                {
                    required: true,
                    message: '主体资质不能为空',
                    trigger: 'blur'
                }
            ],
            otherOptions: {
                placeholder: '请输入主体资质',
            }
        },
        {
            field: 'key8',
            type: 'input',
            label: '主体状态',
            isHidden: false,
            rules: [
                {
                    required: true,
                    message: '主体状态不能为空',
                    trigger: 'blur'
                }
            ],
            otherOptions: {
                disabled: false,
                placeholder: '请输入主体状态',
            }
        }
    ],
    // 表单配置项
    formAttrConfig: {
        // 文字宽度
        labelWidth: '90px',
        // 表单禁用
        disabled: false
    }
}

// 弹框属性配置
export const dialogConfig = {
    title: "",
    width: "60%",
    top: "10vh",
    center: true,
    destroyOnClose: true,
    showClose: true
}